import java.util.Scanner;

import static java.lang.Thread.sleep;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: GaoXu
 * @Date: 2022/05/20/13:37
 * @Description:
 */
public class Main {
    static volatile int count = 0;
    static volatile int flag = count;
    public static void main(String[] args) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("Download文件夹监控中...");
                while (true) {
                    try {
                        sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    if (count != flag) {
                        System.out.println("捕捉到文件数变化");
                        flag = count;
                        count = flag;
                    }
                }
            }
        }).start();
        Scanner input = new Scanner(System.in);
        while (true) {
            int i = input.nextInt();
            count = i;
        }

    }
}
